#ifndef __XMLNODE_H__
#define __XMLNODE_H__

#include <e32base.h>
#include <e32cmn.h>


class CXmlNode : public CBase
{
public:
	static CXmlNode* NewL(const TDesC8& aNodeName, 
			const TDesC8& aNodeValue = KNullDesC8, CXmlNode *aParent = NULL);
	static CXmlNode* NewLC(const TDesC8& aNodeName, 
			const TDesC8& aNodeValue = KNullDesC8, CXmlNode *aParent = NULL);

	~CXmlNode();
	void AddNodeL(const TDesC8& aNodeName, const TDesC8& aNodeValue = KNullDesC8);
	void AddNodeL(const TDesC8& aNodeName, const TInt aValue);
	void AddNodeL(const TDesC8& aNodeName, const TDesC &aNodeValue = KNullDesC);
	void AddNodeL(CXmlNode* aNode); 
	void DeleteNode(TInt aIndex);
	void SetNodeValueL(const TDesC8 &aNodeValue);
	/**
	 * return the node index , not found : -1 
	 */
	TInt FindNodeByNodeValue(const TDesC8& aNodeName, const TDesC8 &aNodeValue);
	
	TInt ChildCount();
	CXmlNode * ChildNode(const TDesC8 &aChildName);
	CXmlNode * ChildNode(TInt aIndex);
	CXmlNode * ParentNode();
	TDesC8 NodeValue();
	TDesC8 ChildNodeValue(const TDesC8 &aChildName);
	TDesC8 NodeName();
	void SetParentNode(CXmlNode* aNode);
	//复制对象,不复制父节点
	CXmlNode*  AllocL();
	
	//���xml����
	HBufC8* GetXMLStringL();
	//����xml���볤��
	TInt Length();
	

private:
	CXmlNode(CXmlNode *aParent);
	void ConstructL(const TDesC8& aNodeName, const TDesC8& aNodeValue);

public:
	HBufC8*		i_pName;//�ڵ����
	HBufC8*		i_pValue;//�ڵ�ֵ
private:
	CArrayPtrFlat<CXmlNode>		*i_pChildNode;//�ӽڵ�Ⱥ
	CXmlNode 					*i_pParent;	//父节点,不需释放内存.
	
};

#endif
